package net.bplaced.streetfighter.utils.update;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.com>
 */
public class Constants {

    public static String FILES_PATH = null;
    public static String APP_VERSION = null;
    public static String APP_PACKAGE = null;

    public static String ANDROID_VERSION = null;
    public static String PHONE_MODEL = null;
    public static String PHONE_MANUFACTURER = null;

    public static String TAG = "HockeyApp";

    public static void loadFromContext(Context context) {

        Constants.ANDROID_VERSION = android.os.Build.VERSION.RELEASE;
        Constants.PHONE_MODEL = android.os.Build.MODEL;
        Constants.PHONE_MANUFACTURER = android.os.Build.MANUFACTURER;

        final PackageManager packageManager = context.getPackageManager();
        try {
            final PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
            Constants.APP_VERSION = "" + packageInfo.versionCode;
            Constants.APP_PACKAGE = packageInfo.packageName;
            Constants.FILES_PATH = context.getFilesDir().getAbsolutePath();
        } catch (final NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}